/*********************************************************
          File Name:static.cpp
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Wed 16 Sep 2015 07:43:39 PM CST
**********************************************************/

#include <iostream>

class T 
{
        private:
                static int s;
        public:
                T() = delete;
                T(int n) { s = n; }
                void plus() { s += 1; }
                void sub() { s -= 1; }
                void get() { std::cout << s << std::endl; }
};

int T::s;       // or explicitly `int T::s = 0;`

int main()
{
        T a(1);
        T b(2);

        a.get();
        b.get();

        a.plus();
        b.get();

        b.plus();
        a.get();

        b.sub();
        a.get();

        return 0;
}
